var $ = require("../../include/$");
var fs = require("fs");
module.exports = {
	post: function (req, res) {
		var upfile = req.files.thisfile;
		var typename = (upfile.name.split("."))[1];
		var filename = (new Date()).getTime().toString();
		var path = upfile.path;
		var _wirtedir = typename + "/" + filename + "." + typename;
		fs.writeFileSync(__dirname + "/../../../public/images/upload/" + _wirtedir, fs.readFileSync(upfile.path));
		// console.log(req.files);
		res.send({
			path: path,
			savedir: "/images/upload/" + _wirtedir
		});
		res.end();
	}
}